package com.snailcatbrowserserver.window.controller;

import com.snailcatbrowserserver.window.domain.DbAdmin;
import com.snailcatbrowserserver.window.service.DbAdminService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/")
public class OpenPage {
    @Resource
    private DbAdminService dbAdminService;
    @RequestMapping("/login")
    public ModelAndView login(){
        ModelAndView mv = new ModelAndView();
        mv.setViewName("login");
        return mv;
    }
    @RequestMapping("/register")
    public ModelAndView registerActions(){
        ModelAndView mv = new ModelAndView();
        mv.setViewName("register");
        return mv;
    }
    @RequestMapping("/modification")
    public ModelAndView modificationActions(){
        ModelAndView mv = new ModelAndView();
        mv.setViewName("modification");
        return mv;
    }
    @RequestMapping("/save")
    public ModelAndView saveAction(DbAdmin dbAdmin){
        ModelAndView mv = new ModelAndView();
        dbAdminService.insertSave(dbAdmin);
        mv.setViewName("success");
        return mv;
    }
}
